package com.lagou.user.controller;

import com.lagou.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-06-02.
 *
 * @author chouFy
 */
@ResponseBody
@Controller
@RequestMapping("/com.lagou.user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/register/{email}/{password}/{code}")
    public Object register(@PathVariable("email") String email,
                           @PathVariable("password") String password,
                           @PathVariable("code") String code) {
        return userService.register(email, password, code);

    }


    @RequestMapping("/isRegistered/{email}")
    public Object isRegistered(@PathVariable("email") String email) {
        return userService.isRegistered(email);

    }

    @RequestMapping("/info/{token}")
    public Object info(@PathVariable("token") String token) {

        return userService.info(token);
    }
}
